/**
 * 文件流下载
 * @param {*} res 文件流
 * @param {String} type 文件类型 例：EXCELL application/vnd.ms-excel;charset=UTF-8  压缩包zip application/zip
 * @param {String} name 文件名
 * @returns
 */
export const download = (res, type, name) => {
  if (!res) {
    return
  }
  const url = window.URL.createObjectURL(new Blob([res], { type }))
  const link = document.createElement('a')
  link.style.display = 'none'
  link.href = url
  link.setAttribute('download', name || '')
  document.body.appendChild(link)
  link.click()
  document.body.removeChild(link)
}
